import { useState, useEffect } from 'react'
import { getChannelsAPI } from '@/api/article'

const useChannels = () => {
    const [channelsList, setChannelsList] = useState([])

    useEffect(() => {
        const getChannelsList = async () => {
            const res = await getChannelsAPI()
            setChannelsList(res.data.channels)
        }
        getChannelsList()
    }, [])

    return {
        channelsList
    }
}

export { useChannels }